************************************************************************ Program written by Melanie M. Wall (last revised 7/23/2011) This SAS program produces all the numerical results presented in the paper Wall MM, Poh E, Cerda M, Keyes K, Galea S, Hasin D. (2011) Adolescent marijuana use from 2002 to 2008: higher in states with medical marijuana laws, cause still unclear. Accepted and to appear in Annals of Epidemiology This program reads in data extracted from the National Survey on Drug Use and Health available on my website and described below. ************************************************************************** DATA description: Each 2 year summary rate of past month marijuana use and percent of percieved great risk associated with frequent marijuana use by 12-17 year olds was extracted (by copy and paste) into an Excel file on March 3, 2011 from the 5 websites listed below. Each website contained state level values for multiple age groups: 12 and older, 12-17, 18-25, and 26 older and they also contain other drug summary data besides marijuana. 2002-2003 and 2003-2004: Table C.3 and Table C.4 at http://oas.samhsa.gov/2k4state/appC.htm 2004-2005: Table C.3 and Table C.4 at http://oas.samhsa.gov/2k5state/appC.htm 2005-2006: Table C.3 and Table C.4 at http://oas.samhsa.gov/2k6state/appC.htm 2006-2007: Table C.3 and Table C.4 at http://oas.samhsa.gov/2k7state/appC.htm 2007-2008: Table C.3 and Table C.4 at http://oas.samhsa.gov/2k8state/appC.htm The specific data used for this project is stored in the comma delimited file named mj data 12-17yr old NSDUH 2002-2008.csv available at http://www.columbia.edu/~mmw2177/MML/ ; options pagesize = 1000 nocenter; ********************************************************************** ****** ****** TO USE: CHANGE THE PATH BELOW to your own directory ****** That is, change C:\Documents\mydatadirectory\ ****** to match the directory where you have stored the dowloaded data **********************************************************************; PROC IMPORT OUT= a DATAFILE= "C:\Documents\mydatadirectory\mj data 12-17yr old NSDUH 2002-2008.csv" DBMS=CSV REPLACE; GETNAMES=YES; DATAROW=2; RUN; ***************************************************** ***************************************************** ****** ****** Organizing and adding information to the DATA ****** *****************************************************; ************************************************** Manipulating the dataset so that it is in LONG format with one record per year per state rather than in WIDE format as it was made originally *************************************************; proc transpose data=a out=longuse prefix=use ; by stateno; var use0203 use0304 use0405 use0506 use0607 use0708; run; proc transpose data=a out=longrisky prefix=risky ; by stateno; var risky0203 risky0304 risky0405 risky0506 risky0607 risky0708; run; data longform; merge longuse (rename=(use1=use) drop=_name_) longrisky (rename=(risky1=risky)) a (keep= stateno statename abbrev); by stateno; yrlabel=substr(_name_, 5); drop _name_; if yrlabel = "y0203" then year = 2003; if yrlabel = "y0304" then year = 2004; if yrlabel = "y0405" then year = 2005; if yrlabel = "y0506" then year = 2006; if yrlabel = "y0607" then year = 2007; if yrlabel = "y0708" then year = 2008; run; ************************************************************************************** ********** ********** ADDING in the medical marijuan law (MML) information ********** **************************************************************************************; data mml; set longform; ***Include an indicator for the 16 states that passed MML by 2011; ever_pass = 0; if abbrev in ("CA","OR","WA","AK", "ME","CO","NV","HI", "MT","VT","RI","NM", "MI","NJ","AZ","DE") then ever_pass = 1; **********************************************; * For the Longitudinal analyses we need to create a time varying indicator of * whether the particular year is before or after MML passage or else whether * the state never passed a law up until 2011 * * The analysis will look at average rates in states before passage * and compare that to averages in states after passage * and compare both of those to states that still had not passed by 2011 * * We create the following "MMLpass" variable... * MMLpass is a time varying covariate coded as BEFORE, AFTER, or NEVER * NOTE that for most states it is constant across all years and thus not time varying but for the following * 5 states that passed laws during the period 2002-2008, it is time varying * * For Montana and * Vermont that passed laws in 2004 they have MMLpass = 1. Before 2. After 3. After 4. After 5. After 6. After * corresponding to 1. 02-03 2. 03-04 3. 04-05 4. 05-06 5. 06-07 6. 07-08 * * For Rhode Island which passed in 2006 it has MMLpass = 1. Before 2. Before 3. Before 4. After 5. After 6. After * corresponding to 1. 02-03 2. 03-04 3. 04-05 4. 05-06 5. 06-07 6. 07-08 * * For New Mexico which passed in 2007 it has MMLpass = 1. Before 2. Before 3. Before 4. Before 5. After 6. After * corresponding to 1. 02-03 2. 03-04 3. 04-05 4. 05-06 5. 06-07 6. 07-08 * * For Michigan which passed in 2008 it has MMLpass = 1. Before 2. Before 3. Before 4. Before 5. Before 6. After * corresponding to 1. 02-03 2. 03-04 3. 04-05 4. 05-06 5. 06-07 6. 07-08 * * New Jersey, Arizona both in 2010 and Delaware in 2011 are coded as Before for all 6 years for the MMLpass variable * while the other 8 states are coded as After for all 6 years ************************************************; *****law_status1 is a 0-1 indicator of whether the MML has been passed yet in the particular state in the particular year; law_status1 = ever_pass; if abbrev = "MT" and year < 2004 then law_status1 = 0; if abbrev = "VT" and year < 2004 then law_status1 = 0; if abbrev = "RI" and year < 2006 then law_status1 = 0; if abbrev = "NM" and year < 2007 then law_status1 = 0; if abbrev = "MI" and year < 2008 then law_status1 = 0; if abbrev = "NJ" and year < 2010 then law_status1 = 0; if abbrev = "AZ" and year < 2010 then law_status1 = 0; if abbrev = "DE" and year < 2011 then law_status1 = 0; ******earlypass is an indicator of whether the state had already passed MML before the first year of NSDUH observation 2002; earlypass = 0; if abbrev in ("CA","OR","WA","AK","ME","CO","NV","HI") then earlypass = 1; ****Note the years of passage for these 8 states were CA(1996), OR(1998), WA(1998), AK(1998), ME(1999), CO(2000), NV(2000), HI(2000); ****Here we create the MMLpass variables using the ever_pass, law_status1, and earlypass indicators; MMLpass = "after"; if ever_pass = 1 and law_status1 = 0 then MMLpass = "before"; if earlypass = 1 then MMLpass = "after"; if ever_pass = 0 then MMLpass = "never"; run; ********************************************************************************** ***** ***** Statistical Analyses ***** **********************************************************************************; ******* Here is the simple mean rates of use and perceived riskiness across all years and all states; proc means data = mml; var use risky; run; ******* Here is the mean rates of use and perceived riskiness by state across the years; proc means data = mml noprint; class abbrev; var use risky; output out = savestate mean = aveuse averisky; run; proc sort data = mml; by abbrev; proc sort data = savestate; by abbrev; ***The withstateave dataset merges in the state averages with the long format data; data withstateave; merge mml savestate (where = (_TYPE_ = 1)); by abbrev; run; ***The collapse dataset n=50 simply keeps the average of the state rates across years along with the indicator of whether the state had MML by 2011; data collapse; set withstateave; by abbrev; if first.abbrev; keep statename abbrev ever_pass aveuse averisky; run; *****Ranking the states by overall average use by 12-17 year olds during the period 2002-2008; proc sort data = collapse; by descending aveuse ; run; proc print data = collapse; run; ******** Here is the simple test of mean difference betweent the 16 and 34 states with and without laws regardless of what year they passed or what year the outcome is examined, it takes the n=50 to be 50 (states) with each observation taken to be the average over the 6 years; proc ttest data = collapse; class ever_pass; var aveuse averisky; run; ******** Here is the test by year of whether states that had passed laws up to and including that year had higher rates - TABLE 1 results; proc sort data = mml; by year; proc ttest data = mml; by year; class law_status1; var use risky; run; run; **********************************************; * Longitudinal analysis * * Controlling for a time trend by year, and accounting for repeated measures within state by including a random * effect for state, the longitudinal analysis compares the rates in states before passage * to the rates after passage to the rates in states that still had not passed MML by 2011 * * *********************************************; ****Longitudinal result for marijuana use in last month for 12-17 year olds; proc mixed data = mml; class abbrev MMLpass; model use = year MMLpass/solution dfm = bw; random abbrev; lsmeans MMLpass/pdiff cl; run; ****Longitudinal result for perceived riskiness of use for 12-17 year olds; proc mixed data = mml; class abbrev MMLpass; model risky = year MMLpass/solution dfm = bw; random abbrev; lsmeans MMLpass/pdiff cl; run; **** Here is an additional analysis that actually incorporates the within state change **** test, but there are only 5 states with a change in law during the 6 years so it is not very powerful **** Note, the null result from this change analysis (because of lack of power) is not presented in the paper; proc mixed data = mml; class abbrev ever_pass law_status1; model use = year ever_pass law_status1/solution; random abbrev; lsmeans law_status1; run;